package com.atguigu.gmall.seckill.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.gmall.seckill.entity.SeckillGoods;
import com.atguigu.gmall.seckill.service.SeckillGoodsService;
import com.atguigu.gmall.seckill.mapper.SeckillGoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author weiranyi
 * @description 针对表【seckill_goods】的数据库操作Service实现
 * @createDate 2022-12-26 09:23:50
 */
@Service
public class SeckillGoodsServiceImpl extends ServiceImpl<SeckillGoodsMapper, SeckillGoods>
        implements SeckillGoodsService {

    @Autowired
    SeckillGoodsMapper seckillGoodsMapper;

    @Override
    public List<SeckillGoods> getTodaySeckillGoods(String date) {
        return seckillGoodsMapper.getTodaySeckillGoods(date);
    }

    @Override
    public boolean updateStockDecrOne(Long id) {
        try {
            seckillGoodsMapper.updateStockDecrOne(id);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}




